package com.jwdf.uda.http.action;

import android.content.Context;

import com.jwdf.uda.bean.PbBean;
import com.jwdf.uda.http.AHttpService;
import com.jwdf.uda.http.ApiService;

import java.util.List;

import retrofit2.Call;

/**
 * Created by Administrator on 2016/9/22.
 */
public class ReplyAddCommentAction extends AHttpService<PbBean.PbResCommentAddComment> {

    private int id;
    private String content;
    private int atCommentId;
    private List<String> imageTokenList;
    private PbBean.PbSignNavType navType;

    private ReplyAddCommentAction(Context context, int id, String content, int atCommentId, List<String> imageTokenList, PbBean.PbSignNavType type) {
        super(context);
        this.id = id;
        this.content = content;
        this.atCommentId = atCommentId;
        this.imageTokenList = imageTokenList;
        this.navType = type;
    }

    public static ReplyAddCommentAction newInstance(Context context, int id, String content, int atCommentId, List<String> imageTokenList, PbBean.PbSignNavType type) {
        return new ReplyAddCommentAction(context, id, content, atCommentId, imageTokenList, type);
    }

    @Override
    protected Call newRetrofitCall(ApiService apiService, PbBean.PbBaseClientInfo.Builder baseBuilder) {
        PbBean.PbReqCommentAddComment.Builder builder = PbBean.PbReqCommentAddComment.newBuilder();
        builder.setBaseClientInfo(baseBuilder);
        builder.setDetailId(id);
        builder.setContent(content);
        builder.setAtCommentId(atCommentId);
        if (imageTokenList != null) {
            builder.addAllImageTokenList(imageTokenList);
        }
        builder.setType(navType);

        return apiService.replyAddComment(builder.build());
    }
}
